//
//  MyStatusBottomView.swift
//  weibo08
//
//  Created by 陈杰明 on 16/3/7.
//  Copyright © 2016年 JM. All rights reserved.
//

import UIKit

class MyStatusBottomView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        prepareUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func prepareUI() {
    //添加子控件
        self.addSubview(forwarButton)
        self.addSubview(commentButton)
        self.addSubview(likeButton)
        self.addSubview(separatorLeftView)
        self.addSubview(separatorRightView)
    //布局
        //转发
        forwarButton.snp_makeConstraints { (make) -> Void in
            make.top.leading.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(1 / 3.0)
        }
        //评论
        commentButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(forwarButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(1 / 3.0)
        }
        //点赞
        likeButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(commentButton.snp_trailing)
            make.trailing.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(1 / 3.0)
            
        }
        //左分隔线
        separatorLeftView.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(forwarButton.snp_trailing)
            make.centerY.equalTo(forwarButton)
        }
        //右分隔线
        separatorRightView.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentButton.snp_trailing)
            make.centerY.equalTo(commentButton)
        }
        
    
    }
    //MARK: - 懒加载
    //转发
    private lazy var forwarButton: UIButton = UIButton(bkgName: "timeline_card_bottom_background", imgName: "timeline_icon_retweet", titleName: "转发", font: 11)
    //评论
    private lazy var commentButton: UIButton = UIButton(bkgName: "timeline_card_bottom_background", imgName: "timeline_icon_comment", titleName: "评论")
    //赞
    private lazy var likeButton: UIButton = UIButton(imgName: "timeline_icon_unlike", titleName: "赞")
    //左边分隔线
    private lazy var separatorLeftView: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    //右边分隔线
    private lazy var separatorRightView: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    private lazy var original: MyStatusOriginalView = MyStatusOriginalView()
}
